import request from '@/config/axios'

/** 上课场地信息信息 */
export interface ClassLocation {
          locationId: number; // 场地唯一ID (注意：前端number类型可以处理Long)
          locationName?: string; // 场地名称，如笃志楼机房9
          buildingId?: number; // 所属建筑物ID
          floor?: number; // 楼层
          roomNumber?: string; // 房间号
          locationType?: string; // 场地类型，如机房、实训室
          locationDetailInfo?: string; // 上课场地详细信息
          classroomCapacity?: number; // 教室人数
          equipmentList?: string; // 设备清单
          managerId?: number; // 管理员ID
          bookingRules?: string; // 预约规则
          status?: number; // 状态（0=禁用 1=启用 2=维修中 3=预约中）
  }

// 上课场地信息 API
export const ClassLocationApi = {
  // 查询上课场地信息分页
  getClassLocationPage: async (params: any) => {
    return await request.get({ url: `/ao/class-location/page`, params })
  },

  // 查询上课场地信息详情
  getClassLocation: async (id: number) => {
    return await request.get({ url: `/ao/class-location/get?id=` + id })
  },

  // 新增上课场地信息
  createClassLocation: async (data: ClassLocation) => {
    return await request.post({ url: `/ao/class-location/create`, data })
  },

  // 修改上课场地信息
  updateClassLocation: async (data: ClassLocation) => {
    return await request.put({ url: `/ao/class-location/update`, data })
  },

  // 删除上课场地信息
  deleteClassLocation: async (id: number) => {
    return await request.delete({ url: `/ao/class-location/delete?id=` + id })
  },

  /** 批量删除上课场地信息 */
  deleteClassLocationList: async (ids: number[]) => {
    return await request.delete({ url: `/ao/class-location/delete-list?ids=${ids.join(',')}` })
  },

  // 导出上课场地信息 Excel
  exportClassLocation: async (params) => {
    return await request.download({ url: `/ao/class-location/export-excel`, params })
  },

  // 获得导入上课场地信息模板
  importClassLocationTemplate: async () => {
    return await request.download({ url: `/ao/class-location/get-import-template` })
  },

  // 导入上课场地信息
  importClassLocation: async (data: FormData) => {
    return await request.upload({ url: `/ao/class-location/import`, data })
  },
}
